Full source code website bán hàng thương mại điện tử gần giống shopee
468.967 lượt xem;
1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2 <tr align=center>
3 <td class="title" width="100%">Hình ảnh : <a href="./?act=album_image_m&page=<? echo $_REQUEST['page']; ?>&cat=<? echo $_REQUEST['cat']; ?>"><font class="V10pt" color="#ffffff">Nhập Mới</font></a>
4 </td>
5 </tr>
6 </table>
7 <?
8 switch ($_GET['action'])
9 {
10 case 'del' :
11 $id = $_GET['id'];
12 $sql="select * from album_images where album_images_id=$id limit 1";
13 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
14 if ($pro)
15 {
16 $sql = "delete from album_images where album_images_id='".$id."'";
17 $result = mysql_query($sql,$con);
18 if ($result)
19 {
20 if (file_exists($pro['album_images_img'])) unlink($pro['album_images_img']);
21 if (file_exists($pro['album_images_imglarge'])) unlink($pro['album_images_imglarge']);
22 echo "<p align=center class='err'>Đã xóa thành công</p>";
23 }
24 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
25 }
26 break;
27 }
28 ?>
29
30 <?
31 if (isset($_POST['ButDel'])) {
32 $cnt=0;
33 foreach ($_POST['chk'] as $id)
34 {
35 $sql="select * from album_images where album_images_id=$id limit 1";
36 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
37 if ($pro)
38 {
39 @$result = mysql_query("delete from album_images where album_images_id='".$id."'",$con);
40 if ($result) {
41 $cnt++;
42 if (file_exists($pro['album_images_img'])) unlink($pro['album_images_img']);
43 if (file_exists($pro['album_images_imglarge'])) unlink($pro['album_images_imglarge']);
44 }
45 }
46 }
47 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
48 }
49 ?>
50
51 <?
52 $page = $_GET["page"];
53 $MAXPAGE=10;
54 $p=0;
55 if ($page!='') $p=$page;
56 $where="1=1";
57 //if ($_REQUEST['status']!='') $where="products_status=".$_REQUEST['status']." ";
58 if ($_REQUEST['cat']!='') $where="album_images_categoriesid=".$_REQUEST['cat'];
59
60 ?>
61 <form method="POST" name="frmList" action="index.php">
62 <input type="hidden" name="act" value="album_image">
63 <input type=hidden name="page" value="<? echo $page; ?>">
64 <?
65 function taotrang($total,$link,$nitem,$itemcurrent,$step=10)
66 { global $con;
67 $ret="";
68
69 $param="";
70 $pages=count_page($total,$nitem);
71 if ($itemcurrent>0) $ret.='<a title="Đầu tiên" href="'.$link.'0" class="lslink">[<]</a> ';
72 if ($itemcurrent>1) $ret.='<a title="Về trước" href="'.$link.($itemcurrent-1).'" class="lslink">[<<]</a> ';
73 $from=($itemcurrent-$step>0?$itemcurrent-$step:0);
74 $to=($itemcurrent+$step<$pages?$itemcurrent+$step:$pages);
75 for ($i=$from;$i<$to;$i++)
76 {
77 if ($i!=$itemcurrent) $ret.='<a href="'.$link.$i.'" class="lslink">'.($i+1).'</a> ';
78 else $ret.='<b>'.($i+1).'</b> ';
79 }
80 if (($itemcurrent<$pages-2) && ($pages>1)) $ret.='<a title="Tiếp theo" href="'.$link.($itemcurrent+1).'">[>>]</a> ';
81 if ($itemcurrent<$pages-1) $ret.='<a title="Cuối cùng" href="'.$link.($pages-1).'">[>]</a>';
82 return $ret;
83 }
84
85 $pageindex=taotrang(CountRecord("album_images",$where),"./?act=album_image&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
86 ?>
87
88 <table cellspacing="0" cellpadding="0" width="100%">
89 <? if ($_REQUEST['code']==1) echo '<tr><td align="center" class="err">Đã cập nhật thành công</td></tr>'; ?>
90 <tr>
91 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
92 <td height="30" align="right" class="smallfont">
93 <select size="1" name="ddCat" class="smallfont">
94 <?
95 $ms=GetListProduct();
96 echo '<option value="">[Tất cả]</option>';
97 foreach ($ms as $m)
98 if ($m[0]!=$_REQUEST['cat'])
99 echo '<option value="'.$m[0].'">'.$m[1].'</option>';
100 else
101 echo '<option selected value="'.$m[0].'">'.$m[1].'</option>';
102 ?>
103 </select>
104 <input type="button" value="Chuyển" class="button" onclick="window.location='./?act=album_image&cat='+ddCat.value">
105 </td>
106
107 </tr>
108 </table>
109
110 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
111 <tr>
112 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
113 <td colspan="2" nowrap class="title"> </td>
114 <td align="center" nowrap class="title"><b>Mã</b></td>
115 <td align="center" nowrap class="title"><b>Tên</b></td>
116 <td align="center" nowrap class="title"><b>Mô tả</b></td>
117 <td align="center" nowrap class="title"><b>Hình nhỏ</b></td>
118 <td align="center" nowrap class="title"><b>Hình lớn</b></td>
119 <td align="center" nowrap class="title"><b>Không hiện</b></td>
120 <td align="center" nowrap class="title"><b>Số lượt xem</b></td>
121 <td align="center" nowrap class="title"><b>Số lượt download</b></td>
122 <td align="center" nowrap class="title"><b>Ngày</b></td>
123 </tr>
124
125 <?php
126 $sql="select * from album_images where $where order by album_images_id limit ".($p*$MAXPAGE).",".$MAXPAGE;
127 $result=mysql_query($sql,$con);
128 $i=0;
129 while(($row=mysql_fetch_array($result)))
130 {
131 $i++;
132 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
133 ?>
134
135 <tr>
136 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
137 <input type="checkbox" name="chk[]" value="<? echo $row['album_images_id']; ?>"></td>
138 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
139 <a href="./?act=album_image_m&cat=<? echo $_REQUEST['cat']; ?>&id=<? echo $row['album_images_id']; ?>&page=<? echo $_REQUEST['page'];?>">
140 Sửa</a></td>
141 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
142 <a href="./?act=album_image&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&action=del&id=<? echo $row['album_images_id']; ?>">
143 Xoá</a></td>
144 <td bgcolor="<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['album_images_id']; ?> </td>
145 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_name']; ?> </td>
146 <td bgcolor="<? echo $color; ?>" class="smallfont"><? //echo $row['album_images_description']; ?> </td>
147 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_img']; ?> </td>
148 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_imglarge']; ?> </td>
149 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_status']; ?> </td>
150 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_view']; ?> </td>
151 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_download']; ?> </td>
152 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_date_added']; ?> </td>
153 </tr>
154 <?
155 }
156 ?>
157 </table>
158 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
159 </form>
160 <script language="JavaScript">
161 function chkallClick(o) {
162 var form = document.frmList;
163 for (var i = 0; i < form.elements.length; i++) {
164 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
165 form.elements[i].checked = document.frmList.chkall.checked;
166 }
167 }
168 }
169 </script>
2 <tr align=center>
3 <td class="title" width="100%">Hình ảnh : <a href="./?act=album_image_m&page=<? echo $_REQUEST['page']; ?>&cat=<? echo $_REQUEST['cat']; ?>"><font class="V10pt" color="#ffffff">Nhập Mới</font></a>
4 </td>
5 </tr>
6 </table>
7 <?
8 switch ($_GET['action'])
9 {
10 case 'del' :
11 $id = $_GET['id'];
12 $sql="select * from album_images where album_images_id=$id limit 1";
13 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
14 if ($pro)
15 {
16 $sql = "delete from album_images where album_images_id='".$id."'";
17 $result = mysql_query($sql,$con);
18 if ($result)
19 {
20 if (file_exists($pro['album_images_img'])) unlink($pro['album_images_img']);
21 if (file_exists($pro['album_images_imglarge'])) unlink($pro['album_images_imglarge']);
22 echo "<p align=center class='err'>Đã xóa thành công</p>";
23 }
24 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
25 }
26 break;
27 }
28 ?>
29
30 <?
31 if (isset($_POST['ButDel'])) {
32 $cnt=0;
33 foreach ($_POST['chk'] as $id)
34 {
35 $sql="select * from album_images where album_images_id=$id limit 1";
36 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
37 if ($pro)
38 {
39 @$result = mysql_query("delete from album_images where album_images_id='".$id."'",$con);
40 if ($result) {
41 $cnt++;
42 if (file_exists($pro['album_images_img'])) unlink($pro['album_images_img']);
43 if (file_exists($pro['album_images_imglarge'])) unlink($pro['album_images_imglarge']);
44 }
45 }
46 }
47 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
48 }
49 ?>
50
51 <?
52 $page = $_GET["page"];
53 $MAXPAGE=10;
54 $p=0;
55 if ($page!='') $p=$page;
56 $where="1=1";
57 //if ($_REQUEST['status']!='') $where="products_status=".$_REQUEST['status']." ";
58 if ($_REQUEST['cat']!='') $where="album_images_categoriesid=".$_REQUEST['cat'];
59
60 ?>
61 <form method="POST" name="frmList" action="index.php">
62 <input type="hidden" name="act" value="album_image">
63 <input type=hidden name="page" value="<? echo $page; ?>">
64 <?
65 function taotrang($total,$link,$nitem,$itemcurrent,$step=10)
66 { global $con;
67 $ret="";
68
69 $param="";
70 $pages=count_page($total,$nitem);
71 if ($itemcurrent>0) $ret.='<a title="Đầu tiên" href="'.$link.'0" class="lslink">[<]</a> ';
72 if ($itemcurrent>1) $ret.='<a title="Về trước" href="'.$link.($itemcurrent-1).'" class="lslink">[<<]</a> ';
73 $from=($itemcurrent-$step>0?$itemcurrent-$step:0);
74 $to=($itemcurrent+$step<$pages?$itemcurrent+$step:$pages);
75 for ($i=$from;$i<$to;$i++)
76 {
77 if ($i!=$itemcurrent) $ret.='<a href="'.$link.$i.'" class="lslink">'.($i+1).'</a> ';
78 else $ret.='<b>'.($i+1).'</b> ';
79 }
80 if (($itemcurrent<$pages-2) && ($pages>1)) $ret.='<a title="Tiếp theo" href="'.$link.($itemcurrent+1).'">[>>]</a> ';
81 if ($itemcurrent<$pages-1) $ret.='<a title="Cuối cùng" href="'.$link.($pages-1).'">[>]</a>';
82 return $ret;
83 }
84
85 $pageindex=taotrang(CountRecord("album_images",$where),"./?act=album_image&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
86 ?>
87
88 <table cellspacing="0" cellpadding="0" width="100%">
89 <? if ($_REQUEST['code']==1) echo '<tr><td align="center" class="err">Đã cập nhật thành công</td></tr>'; ?>
90 <tr>
91 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
92 <td height="30" align="right" class="smallfont">
93 <select size="1" name="ddCat" class="smallfont">
94 <?
95 $ms=GetListProduct();
96 echo '<option value="">[Tất cả]</option>';
97 foreach ($ms as $m)
98 if ($m[0]!=$_REQUEST['cat'])
99 echo '<option value="'.$m[0].'">'.$m[1].'</option>';
100 else
101 echo '<option selected value="'.$m[0].'">'.$m[1].'</option>';
102 ?>
103 </select>
104 <input type="button" value="Chuyển" class="button" onclick="window.location='./?act=album_image&cat='+ddCat.value">
105 </td>
106
107 </tr>
108 </table>
109
110 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
111 <tr>
112 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
113 <td colspan="2" nowrap class="title"> </td>
114 <td align="center" nowrap class="title"><b>Mã</b></td>
115 <td align="center" nowrap class="title"><b>Tên</b></td>
116 <td align="center" nowrap class="title"><b>Mô tả</b></td>
117 <td align="center" nowrap class="title"><b>Hình nhỏ</b></td>
118 <td align="center" nowrap class="title"><b>Hình lớn</b></td>
119 <td align="center" nowrap class="title"><b>Không hiện</b></td>
120 <td align="center" nowrap class="title"><b>Số lượt xem</b></td>
121 <td align="center" nowrap class="title"><b>Số lượt download</b></td>
122 <td align="center" nowrap class="title"><b>Ngày</b></td>
123 </tr>
124
125 <?php
126 $sql="select * from album_images where $where order by album_images_id limit ".($p*$MAXPAGE).",".$MAXPAGE;
127 $result=mysql_query($sql,$con);
128 $i=0;
129 while(($row=mysql_fetch_array($result)))
130 {
131 $i++;
132 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
133 ?>
134
135 <tr>
136 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
137 <input type="checkbox" name="chk[]" value="<? echo $row['album_images_id']; ?>"></td>
138 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
139 <a href="./?act=album_image_m&cat=<? echo $_REQUEST['cat']; ?>&id=<? echo $row['album_images_id']; ?>&page=<? echo $_REQUEST['page'];?>">
140 Sửa</a></td>
141 <td align="center" bgcolor="<? echo $color; ?>" class="smallfont">
142 <a href="./?act=album_image&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&action=del&id=<? echo $row['album_images_id']; ?>">
143 Xoá</a></td>
144 <td bgcolor="<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['album_images_id']; ?> </td>
145 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_name']; ?> </td>
146 <td bgcolor="<? echo $color; ?>" class="smallfont"><? //echo $row['album_images_description']; ?> </td>
147 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_img']; ?> </td>
148 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_imglarge']; ?> </td>
149 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_status']; ?> </td>
150 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_view']; ?> </td>
151 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_download']; ?> </td>
152 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['album_images_date_added']; ?> </td>
153 </tr>
154 <?
155 }
156 ?>
157 </table>
158 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
159 </form>
160 <script language="JavaScript">
161 function chkallClick(o) {
162 var form = document.frmList;
163 for (var i = 0; i < form.elements.length; i++) {
164 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
165 form.elements[i].checked = document.frmList.chkall.checked;
166 }
167 }
168 }
169 </script>